package
{
	import mx.controls.Image;

	[Event(name="refreshIcon", type="MineFieldEvent")]
	public class MineFieldItemButton extends Image
	{		
		public function setup(value: Number): void {
			_value = value;
			_isOpened = false;
			refreshIcon();
		}
		
		public function refreshIcon(): void {
			if (_isOpened) {
				data = BoardIcons.FromIndex(_value);
			}
			else
				data = BoardIcons.CLOSED;
			//dispatchEvent(new MineFieldEvent(MineFieldEvent.REFRESH_ICON));
		}
		
		public function get isOpened(): Boolean { 
			return _isOpened;	
		}
		
		public function get Value(): Number {
			return _value;
		}
		
		private var _isOpened: Boolean;
		private var _value: Number;
	}
}